<template>
    <el-tree 
      :data="data" 
      :props="defaultProps" 
      node-key="id"
      :default-expanded-keys="expkey"
      @node-click="HandleNodeClick" 
      highlight-current
      :default-expand-all="expandall"
      :expand-on-click-node="clicknode"
      ref="tree"
      >
    </el-tree>
</template>

<script>
  export default {
    props:['data','expkey','expandall','clicknode'],
    data() {
      return {
        defaultProps: {
          children: 'children',
          label: 'label'
        },
      };
    },
    methods: {
      HandleNodeClick(data) {
        //console.log(data);
        this.$emit('node-click', data);
      },
      SetCurrentNode(note){
        this.$refs['tree'].setCurrentNode(note);
      }
    },
  };
</script>